﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace AutoParkingManagement
{
    public partial class LaneEntry : UserControl
    {        
        #region "Constructors"
        public LaneEntry()
        {
            InitializeComponent();
        }
        #endregion

        #region "Private members"
        #endregion

        #region Properties
        #endregion

        #region Public members
        public void CaptureImage()
        {
            if (picFront.Tag == null || picFront.Tag.ToString() == "1")
            {
                picFront.Appearance.ImageBackground = Properties.Resources.Front2;
                picRear.Appearance.ImageBackground = Properties.Resources.Rear2;
                picFront.Tag = "2";
            }
            else
            {
                picFront.Appearance.ImageBackground = Properties.Resources.Front1;
                picRear.Appearance.ImageBackground = Properties.Resources.Rear1;
                picFront.Tag = "1";
            }
        }

        public void SaveImage()
        {
            if (picFront.Appearance.ImageBackground == null) return;
            picFront.Appearance.ImageBackground = null;
            picFront.Tag = null;
            picRear.Appearance.ImageBackground = null;
        }

        public void ResetLane()
        {
            picFront.Appearance.ImageBackground = null;
            picFront.Tag = null;
            picRear.Appearance.ImageBackground = null;
        }
        #endregion

        #region Events
        private void LaneEntry_Load(object sender, EventArgs e)
        {
            //For demo camera
            webCamFront.FileName = String.Format(@"{0}/{1}", Application.StartupPath, "FlickAnimation.avi");
            webCamRear.FileName = webCamFront.FileName;
        }
        #endregion
        
    }
}
